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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: C = None
        self.t: B = None
        self.r: B = None
        self.txt = txt

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

f = A("f")
n = B("n")
d = C("d")
j = D("j")
b = C("b")
m = C("m")
c = A("c")
a = A("a")

f.w = n
f.u = n
f.q = n
f.t = c
n.u = j
n.t = f
d.x = n
d.t = n
d.r = n
d.v = m
j.p = f
j.o = c
b.x = n
b.t = n
b.r = n
b.v = d
m.x = n
m.t = n
m.r = n
m.v = b
c.w = n
c.u = n
c.q = n
c.t = f
a.w = n
a.u = n
a.q = n
a.t = f
assert f.t.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: B = None
        self.t: A = None
        self.q: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: C = None
        self.t: B = None
        self.r: B = None
        self.txt = txt

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

f = A("f")
n = B("n")
d = C("d")
j = D("j")
b = C("b")
m = C("m")
c = A("c")
a = A("a")

f.w = n
f.u = n
f.q = n
f.t = c
n.u = j
n.t = f
d.x = n
d.t = n
d.r = n
d.v = m
j.p = f
j.o = c
b.x = n
b.t = n
b.r = n
b.v = d
m.x = n
m.t = n
m.r = n
m.v = b
c.w = n
c.u = n
c.q = n
c.t = f
a.w = n
a.u = n
a.q = n
a.t = f
assert f.t.w.u.txt == "j"