class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: B = None
        self.y: C = None
        self.o: C = None
        self.u: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: D = None
        self.z: E = None
        self.v: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: F = None
        self.w: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

f = A("f")
j = B("j")
g = C("g")
b = D("b")
c = E("c")
i = F("i")
e = D("e")
m = C("m")
a = A("a")

f.p = g
f.y = g
f.q = j
f.o = m
f.u = a
j.r = f
g.y = m
g.q = b
g.z = c
g.v = j
b.r = i
b.v = i
c.o = a
c.r = i
c.w = f
i.u = g
e.r = i
e.v = i
m.y = g
m.q = b
m.z = c
m.v = j
a.p = g
a.y = g
a.q = j
a.o = m
a.u = f
assert i.u.v.r.q.r.y.q.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: B = None
        self.y: C = None
        self.o: C = None
        self.u: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: D = None
        self.z: E = None
        self.v: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.r: F = None
        self.w: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

f = A("f")
j = B("j")
g = C("g")
b = D("b")
c = E("c")
i = F("i")
e = D("e")
m = C("m")
a = A("a")

f.p = g
f.y = g
f.q = j
f.o = m
f.u = a
j.r = f
g.y = m
g.q = b
g.z = c
g.v = j
b.r = i
b.v = i
c.o = a
c.r = i
c.w = f
i.u = g
e.r = i
e.v = i
m.y = g
m.q = b
m.z = c
m.v = j
a.p = g
a.y = g
a.q = j
a.o = m
a.u = f
assert i.u.v.r.q.r.y.q.r.u.txt == "g"