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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.q: E = None
        self.p: F = None
        self.t: A = None
        self.z: E = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.q: E = None
        self.p: F = None
        self.t: A = None
        self.z: E = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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