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

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

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

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

c = A("c")
a = B("a")
g = C("g")
n = D("n")

c.v = n
c.y = n
a.u = c
a.v = c
g.o = c
g.t = n
n.p = c
n.w = c
n.q = c
n.u = a
assert n.u.u.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: D = None
        self.txt = txt

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

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

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

c = A("c")
a = B("a")
g = C("g")
n = D("n")

c.v = n
c.y = n
a.u = c
a.v = c
g.o = c
g.t = n
n.p = c
n.w = c
n.q = c
n.u = a
assert n.u.u.y.u.txt == "a"