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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: C = None
        self.w: C = None
        self.u: F = None
        self.v: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: A = None
        self.y: G = None
        self.t: E = None
        self.q: D = None
        self.z: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: E = None
        self.y: B = None
        self.z: E = None
        self.o: C = None
        self.txt = txt

f = A("f")
d = B("d")
h = C("h")
l = D("l")
n = E("n")
k = F("k")
e = G("e")

f.u = d
d.w = f
d.t = f
h.q = n
l.o = d
l.t = h
l.w = h
l.v = h
l.u = k
n.p = h
n.o = l
k.o = l
k.q = l
k.s = f
k.z = f
k.y = e
k.t = n
e.w = n
e.x = n
e.z = n
e.y = d
e.o = h
assert e.o.q.p.q.p.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: C = None
        self.w: C = None
        self.u: F = None
        self.v: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: A = None
        self.y: G = None
        self.t: E = None
        self.q: D = None
        self.z: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: E = None
        self.y: B = None
        self.z: E = None
        self.o: C = None
        self.txt = txt

f = A("f")
d = B("d")
h = C("h")
l = D("l")
n = E("n")
k = F("k")
e = G("e")

f.u = d
d.w = f
d.t = f
h.q = n
l.o = d
l.t = h
l.w = h
l.v = h
l.u = k
n.p = h
n.o = l
k.o = l
k.q = l
k.s = f
k.z = f
k.y = e
k.t = n
e.w = n
e.x = n
e.z = n
e.y = d
e.o = h
assert e.o.q.p.q.p.q.o.txt == "l"