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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.o: D = None
        self.q: D = None
        self.p: B = None
        self.txt = txt

c = A("c")
l = B("l")
g = C("g")
j = D("j")
d = E("d")
n = F("n")
i = C("i")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.o: D = None
        self.q: D = None
        self.p: B = None
        self.txt = txt

c = A("c")
l = B("l")
g = C("g")
j = D("j")
d = E("d")
n = F("n")
i = C("i")

c.y = j
l.p = c
l.u = j
l.v = n
g.y = c
j.v = g
j.y = l
d.v = l
n.w = d
n.o = j
n.q = j
n.p = l
i.y = c
assert n.p.p.y.y.txt == "l"