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

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

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

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

l = A("l")
c = B("c")
e = C("e")
g = D("g")
f = C("f")
b = A("b")
a = D("a")
k = B("k")

l.p = a
l.w = a
l.x = k
c.v = b
c.p = b
c.q = k
c.r = g
e.p = b
e.u = c
e.v = a
g.o = k
f.p = l
f.u = c
f.v = a
b.p = g
b.w = g
b.x = c
a.o = k
k.v = b
k.q = c
k.r = a
k.p = l
assert c.p.p.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: B = None
        self.w: D = None
        self.txt = txt

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

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

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

l = A("l")
c = B("c")
e = C("e")
g = D("g")
f = C("f")
b = A("b")
a = D("a")
k = B("k")

l.p = a
l.w = a
l.x = k
c.v = b
c.p = b
c.q = k
c.r = g
e.p = b
e.u = c
e.v = a
g.o = k
f.p = l
f.u = c
f.v = a
b.p = g
b.w = g
b.x = c
a.o = k
k.v = b
k.q = c
k.r = a
k.p = l
assert c.p.p.o.q.txt == "c"