class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: D = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: E = None
        self.p: D = None
        self.w: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: B = None
        self.x: B = None
        self.s: B = None
        self.t: D = None
        self.w: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: B = None
        self.x: E = None
        self.t: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: C = None
        self.u: A = None
        self.z: C = None
        self.p: E = None
        self.v: D = None
        self.txt = txt

a = A("a")
k = B("k")
h = C("h")
m = D("m")
b = E("b")
n = F("n")
c = C("c")
d = E("d")
e = D("e")

a.x = h
a.w = m
a.y = n
k.r = e
k.v = d
k.p = m
k.w = a
h.p = c
m.p = n
m.q = k
m.x = k
m.s = k
m.t = e
m.w = a
b.z = h
b.p = k
b.x = d
b.t = a
n.t = d
n.q = c
n.z = c
n.u = a
n.p = b
n.v = e
c.p = h
d.z = c
d.p = k
d.x = b
d.t = a
e.p = n
e.q = k
e.x = k
e.s = k
e.t = m
e.w = a
assert d.x.x.z.p.p.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: D = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: E = None
        self.p: D = None
        self.w: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: B = None
        self.x: B = None
        self.s: B = None
        self.t: D = None
        self.w: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: B = None
        self.x: E = None
        self.t: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: C = None
        self.u: A = None
        self.z: C = None
        self.p: E = None
        self.v: D = None
        self.txt = txt

a = A("a")
k = B("k")
h = C("h")
m = D("m")
b = E("b")
n = F("n")
c = C("c")
d = E("d")
e = D("e")

a.x = h
a.w = m
a.y = n
k.r = e
k.v = d
k.p = m
k.w = a
h.p = c
m.p = n
m.q = k
m.x = k
m.s = k
m.t = e
m.w = a
b.z = h
b.p = k
b.x = d
b.t = a
n.t = d
n.q = c
n.z = c
n.u = a
n.p = b
n.v = e
c.p = h
d.z = c
d.p = k
d.x = b
d.t = a
e.p = n
e.q = k
e.x = k
e.s = k
e.t = m
e.w = a
assert d.x.x.z.p.p.p.p.p.p.txt == "c"