class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: F = None
        self.q: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: F = None
        self.p: F = None
        self.w: B = None
        self.txt = txt

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

g = A("g")
d = B("d")
f = C("f")
k = D("k")
j = E("j")
c = F("c")
h = E("h")
a = C("a")
i = A("i")

g.z = d
g.x = c
d.r = k
f.t = g
f.z = c
f.q = c
k.u = d
j.u = h
j.x = c
j.p = c
j.w = d
c.u = i
c.y = f
c.v = g
c.t = k
h.u = j
h.x = c
h.p = c
h.w = d
a.t = g
a.z = c
a.q = c
i.z = d
i.x = c
assert d.r.u.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: F = None
        self.q: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: F = None
        self.p: F = None
        self.w: B = None
        self.txt = txt

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

g = A("g")
d = B("d")
f = C("f")
k = D("k")
j = E("j")
c = F("c")
h = E("h")
a = C("a")
i = A("i")

g.z = d
g.x = c
d.r = k
f.t = g
f.z = c
f.q = c
k.u = d
j.u = h
j.x = c
j.p = c
j.w = d
c.u = i
c.y = f
c.v = g
c.t = k
h.u = j
h.x = c
h.p = c
h.w = d
a.t = g
a.z = c
a.q = c
i.z = d
i.x = c
assert d.r.u.r.u.r.txt == "k"