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

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

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

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

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

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

f = A("f")
j = B("j")
c = C("c")
n = D("n")
l = E("l")
g = F("g")
d = F("d")

f.t = n
f.v = n
f.r = j
f.s = j
j.u = g
j.x = n
c.o = f
c.w = f
n.t = j
n.v = j
n.s = f
n.r = f
l.z = n
l.p = g
l.y = c
l.v = j
g.w = j
d.w = j
assert n.s.r.u.w.u.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: D = None
        self.r: B = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

f = A("f")
j = B("j")
c = C("c")
n = D("n")
l = E("l")
g = F("g")
d = F("d")

f.t = n
f.v = n
f.r = j
f.s = j
j.u = g
j.x = n
c.o = f
c.w = f
n.t = j
n.v = j
n.s = f
n.r = f
l.z = n
l.p = g
l.y = c
l.v = j
g.w = j
d.w = j
assert n.s.r.u.w.u.w.u.txt == "g"