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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.r: C = None
        self.txt = txt

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

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

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