class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: A = None
        self.y: A = None
        self.txt = txt

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

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

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

g = A("g")
k = B("k")
m = C("m")
f = D("f")
c = A("c")
b = D("b")
i = A("i")
e = C("e")
j = D("j")
n = C("n")

g.p = c
g.v = c
g.y = i
k.w = i
k.v = j
k.t = e
k.p = c
m.x = k
m.o = g
f.x = b
f.y = n
f.q = m
c.p = g
c.v = g
c.y = g
b.x = f
b.y = m
b.q = n
i.p = c
i.v = c
i.y = c
e.x = k
e.o = g
j.x = b
j.y = n
j.q = e
n.x = k
n.o = i
assert f.x.y.x.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: A = None
        self.y: A = None
        self.txt = txt

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

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

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

g = A("g")
k = B("k")
m = C("m")
f = D("f")
c = A("c")
b = D("b")
i = A("i")
e = C("e")
j = D("j")
n = C("n")

g.p = c
g.v = c
g.y = i
k.w = i
k.v = j
k.t = e
k.p = c
m.x = k
m.o = g
f.x = b
f.y = n
f.q = m
c.p = g
c.v = g
c.y = g
b.x = f
b.y = m
b.q = n
i.p = c
i.v = c
i.y = c
e.x = k
e.o = g
j.x = b
j.y = n
j.q = e
n.x = k
n.o = i
assert f.x.y.x.t.x.txt == "k"