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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: D = None
        self.q: F = None
        self.u: C = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

h = A("h")
b = B("b")
c = C("c")
l = D("l")
k = E("k")
m = F("m")
g = D("g")
f = A("f")
e = C("e")
n = F("n")

h.r = f
b.x = m
b.w = k
b.p = n
b.s = n
b.y = h
b.q = g
c.r = b
c.p = g
c.q = n
c.u = e
l.y = n
l.q = n
l.w = c
l.z = k
l.p = k
l.t = h
k.y = e
k.s = g
m.z = k
g.y = n
g.q = n
g.w = e
g.z = k
g.p = k
g.t = f
f.r = h
e.r = b
e.p = g
e.q = n
e.u = c
n.z = k
assert b.s.z.s.y.z.y.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: D = None
        self.q: F = None
        self.u: C = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

h = A("h")
b = B("b")
c = C("c")
l = D("l")
k = E("k")
m = F("m")
g = D("g")
f = A("f")
e = C("e")
n = F("n")

h.r = f
b.x = m
b.w = k
b.p = n
b.s = n
b.y = h
b.q = g
c.r = b
c.p = g
c.q = n
c.u = e
l.y = n
l.q = n
l.w = c
l.z = k
l.p = k
l.t = h
k.y = e
k.s = g
m.z = k
g.y = n
g.q = n
g.w = e
g.z = k
g.p = k
g.t = f
f.r = h
e.r = b
e.p = g
e.q = n
e.u = c
n.z = k
assert b.s.z.s.y.z.y.q.z.txt == "k"