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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: F = None
        self.w: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: F = None
        self.u: C = None
        self.z: A = None
        self.txt = txt

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

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

d.q = g
d.s = g
d.u = f
d.o = f
d.p = f
d.x = j
j.s = f
j.x = g
j.p = l
j.q = n
g.u = f
g.q = n
f.t = l
f.p = l
f.w = l
n.w = d
n.z = d
n.y = l
n.u = g
l.r = d
l.v = n
assert g.q.y.r.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: D = None
        self.s: C = None
        self.o: D = None
        self.p: D = None
        self.x: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.p: F = None
        self.w: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: F = None
        self.u: C = None
        self.z: A = None
        self.txt = txt

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

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

d.q = g
d.s = g
d.u = f
d.o = f
d.p = f
d.x = j
j.s = f
j.x = g
j.p = l
j.q = n
g.u = f
g.q = n
f.t = l
f.p = l
f.w = l
n.w = d
n.z = d
n.y = l
n.u = g
l.r = d
l.v = n
assert g.q.y.r.x.p.txt == "l"