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

class B:
    def __init__(self, txt: str):
        self.z: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: E = None
        self.r: A = None
        self.q: A = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: C = None
        self.u: F = None
        self.q: F = None
        self.o: F = None
        self.s: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: E = None
        self.txt = txt

b = A("b")
i = B("i")
a = C("a")
l = D("l")
e = E("e")
m = F("m")
f = G("f")

b.p = l
b.u = i
i.z = f
a.t = m
a.p = e
a.r = b
a.q = b
a.s = f
l.t = e
l.v = a
e.r = a
e.v = a
e.u = m
e.q = m
e.o = m
e.s = f
m.o = a
f.q = l
f.p = e
assert b.u.z.p.v.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: E = None
        self.r: A = None
        self.q: A = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: C = None
        self.u: F = None
        self.q: F = None
        self.o: F = None
        self.s: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: E = None
        self.txt = txt

b = A("b")
i = B("i")
a = C("a")
l = D("l")
e = E("e")
m = F("m")
f = G("f")

b.p = l
b.u = i
i.z = f
a.t = m
a.p = e
a.r = b
a.q = b
a.s = f
l.t = e
l.v = a
e.r = a
e.v = a
e.u = m
e.q = m
e.o = m
e.s = f
m.o = a
f.q = l
f.p = e
assert b.u.z.p.v.r.u.txt == "i"