class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: C = None
        self.o: B = None
        self.x: C = None
        self.txt = txt

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

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

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

g = A("g")
i = B("i")
c = C("c")
f = D("f")
d = D("d")
m = B("m")
j = C("j")
k = B("k")

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

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

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

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

g = A("g")
i = B("i")
c = C("c")
f = D("f")
d = D("d")
m = B("m")
j = C("j")
k = B("k")

g.p = j
g.x = j
g.z = c
g.o = k
i.u = m
i.t = j
i.v = g
i.y = f
c.s = k
c.x = k
c.t = k
f.o = j
f.p = j
f.w = g
f.t = c
d.o = j
d.p = j
d.w = g
d.t = c
m.u = i
m.t = j
m.v = g
m.y = f
j.s = m
j.x = k
j.t = i
k.u = m
k.t = c
k.v = g
k.y = d
assert f.t.x.y.w.o.v.p.txt == "j"