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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: C = None
        self.u: A = None
        self.p: E = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: E = None
        self.o: D = None
        self.p: F = None
        self.txt = txt

l = A("l")
h = B("h")
e = C("e")
g = D("g")
d = E("d")
n = F("n")
a = E("a")
k = E("k")
b = F("b")
j = A("j")

l.p = j
h.r = g
h.t = e
h.u = j
h.p = a
e.r = d
g.q = e
g.r = e
d.x = n
d.r = g
d.o = j
d.y = h
d.z = h
n.u = e
n.t = k
n.o = g
n.p = b
a.x = b
a.r = g
a.o = j
a.y = h
a.z = h
k.x = n
k.r = g
k.o = j
k.y = h
k.z = h
b.u = e
b.t = d
b.o = g
b.p = n
j.p = l
assert e.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: C = None
        self.u: A = None
        self.p: E = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: E = None
        self.o: D = None
        self.p: F = None
        self.txt = txt

l = A("l")
h = B("h")
e = C("e")
g = D("g")
d = E("d")
n = F("n")
a = E("a")
k = E("k")
b = F("b")
j = A("j")

l.p = j
h.r = g
h.t = e
h.u = j
h.p = a
e.r = d
g.q = e
g.r = e
d.x = n
d.r = g
d.o = j
d.y = h
d.z = h
n.u = e
n.t = k
n.o = g
n.p = b
a.x = b
a.r = g
a.o = j
a.y = h
a.z = h
k.x = n
k.r = g
k.o = j
k.y = h
k.z = h
b.u = e
b.t = d
b.o = g
b.p = n
j.p = l
assert e.r.r.r.r.r.txt == "g"