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

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

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

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

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

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

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

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

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

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

g.y = k
g.o = f
m.o = f
m.p = k
m.y = k
m.s = c
k.o = m
k.p = f
c.v = m
c.p = m
c.x = f
c.t = k
f.y = k
f.o = g
assert g.y.p.y.o.txt == "m"