class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: C = None
        self.r: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: C = None
        self.x: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: E = None
        self.r: C = None
        self.txt = txt

m = A("m")
c = B("c")
b = C("b")
a = D("a")
l = E("l")
j = F("j")
d = E("d")
f = B("f")
n = C("n")

m.t = d
c.t = f
c.r = f
c.y = b
b.p = n
b.q = l
a.y = d
l.s = m
l.x = m
l.y = n
j.y = b
j.r = b
j.x = l
d.s = m
d.x = m
d.y = n
f.t = c
f.r = c
f.y = b
n.p = b
n.q = l
assert l.s.t.y.q.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: C = None
        self.r: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: C = None
        self.x: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: E = None
        self.r: C = None
        self.txt = txt

m = A("m")
c = B("c")
b = C("b")
a = D("a")
l = E("l")
j = F("j")
d = E("d")
f = B("f")
n = C("n")

m.t = d
c.t = f
c.r = f
c.y = b
b.p = n
b.q = l
a.y = d
l.s = m
l.x = m
l.y = n
j.y = b
j.r = b
j.x = l
d.s = m
d.x = m
d.y = n
f.t = c
f.r = c
f.y = b
n.p = b
n.q = l
assert l.s.t.y.q.x.t.txt == "d"