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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: A = None
        self.w: D = None
        self.u: B = None
        self.txt = txt

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

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

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

h = A("h")
m = B("m")
g = C("g")
c = D("c")
d = E("d")
e = F("e")
f = C("f")

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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: A = None
        self.w: D = None
        self.u: B = None
        self.txt = txt

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

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

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

h = A("h")
m = B("m")
g = C("g")
c = D("c")
d = E("d")
e = F("e")
f = C("f")

h.r = c
m.y = c
m.t = e
g.o = h
g.v = h
g.w = c
g.u = m
c.x = d
c.y = d
c.o = d
c.t = m
d.s = g
d.z = e
d.u = h
d.x = h
d.t = m
e.s = h
e.x = d
e.p = d
e.w = d
e.r = m
e.q = m
f.o = h
f.v = h
f.w = c
f.u = m
assert h.r.t.t.s.r.t.txt == "m"