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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: B = None
        self.u: C = None
        self.z: A = None
        self.w: F = None
        self.txt = txt

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

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

h = A("h")
c = B("c")
b = C("b")
m = D("m")
i = E("i")
j = F("j")
d = B("d")
a = F("a")

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: B = None
        self.u: C = None
        self.z: A = None
        self.w: F = None
        self.txt = txt

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

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

h = A("h")
c = B("c")
b = C("b")
m = D("m")
i = E("i")
j = F("j")
d = B("d")
a = F("a")

h.y = j
c.t = b
c.z = i
c.s = i
c.p = d
b.x = c
m.r = b
m.u = b
m.s = c
m.z = h
m.w = a
i.u = m
j.r = m
j.y = c
j.q = c
j.t = b
d.t = b
d.z = i
d.s = i
d.p = c
a.r = m
a.y = d
a.q = d
a.t = b
assert h.y.r.s.t.x.txt == "c"