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

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

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: C = None
        self.x: F = None
        self.z: E = None
        self.v: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.txt = txt

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

i.p = a
i.t = b
l.u = i
a.o = i
a.w = d
a.v = d
a.x = n
b.t = d
b.z = d
b.o = a
b.x = n
b.v = i
d.p = n
n.z = l
n.w = d
n.y = d
n.v = b
f.q = i
f.t = l
assert f.q.p.o.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: C = None
        self.x: F = None
        self.z: E = None
        self.v: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.txt = txt

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

i.p = a
i.t = b
l.u = i
a.o = i
a.w = d
a.v = d
a.x = n
b.t = d
b.z = d
b.o = a
b.x = n
b.v = i
d.p = n
n.z = l
n.w = d
n.y = d
n.v = b
f.q = i
f.t = l
assert f.q.p.o.p.x.txt == "n"