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

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

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

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

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

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

a = A("a")
d = B("d")
k = C("k")
l = D("l")
g = E("g")
b = F("b")
i = D("i")

a.p = k
a.q = k
a.x = k
a.s = b
a.r = l
a.u = d
d.q = a
d.w = k
k.u = g
l.y = d
g.q = l
g.z = b
g.o = d
g.u = d
g.w = k
b.t = k
b.u = k
b.s = g
b.w = a
i.y = d
assert d.q.u.w.u.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: F = None
        self.r: D = None
        self.q: C = None
        self.u: B = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

a = A("a")
d = B("d")
k = C("k")
l = D("l")
g = E("g")
b = F("b")
i = D("i")

a.p = k
a.q = k
a.x = k
a.s = b
a.r = l
a.u = d
d.q = a
d.w = k
k.u = g
l.y = d
g.q = l
g.z = b
g.o = d
g.u = d
g.w = k
b.t = k
b.u = k
b.s = g
b.w = a
i.y = d
assert d.q.u.w.u.u.q.txt == "a"