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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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