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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: A = None
        self.r: E = None
        self.y: B = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: F = None
        self.u: F = None
        self.o: A = None
        self.txt = txt

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

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

h.y = i
h.u = i
h.q = n
h.r = j
b.u = n
b.o = h
b.r = m
b.y = i
e.z = c
e.o = k
e.p = g
n.s = k
m.t = b
m.v = j
m.u = g
m.o = h
g.y = i
j.y = i
i.u = n
i.o = c
i.r = m
i.y = b
k.z = c
k.o = e
k.p = g
c.y = b
c.u = b
c.q = n
c.r = j
assert g.y.y.y.y.y.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: D = None
        self.u: B = None
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.o: A = None
        self.r: E = None
        self.y: B = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: F = None
        self.u: F = None
        self.o: A = None
        self.txt = txt

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

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

h.y = i
h.u = i
h.q = n
h.r = j
b.u = n
b.o = h
b.r = m
b.y = i
e.z = c
e.o = k
e.p = g
n.s = k
m.t = b
m.v = j
m.u = g
m.o = h
g.y = i
j.y = i
i.u = n
i.o = c
i.r = m
i.y = b
k.z = c
k.o = e
k.p = g
c.y = b
c.u = b
c.q = n
c.r = j
assert g.y.y.y.y.y.y.r.txt == "m"