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

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

c = A("c")
k = B("k")
j = C("j")
m = D("m")
a = E("a")
g = F("g")
l = C("l")
f = C("f")
h = F("h")

c.p = g
c.q = m
c.v = j
c.t = h
c.o = a
c.u = a
k.o = j
k.p = m
k.t = a
j.q = g
m.u = c
m.y = c
m.p = c
m.r = f
m.x = f
a.t = m
g.p = k
g.u = c
g.s = h
l.q = g
f.q = g
h.p = k
h.u = c
h.s = g
assert a.t.r.q.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: D = None
        self.v: C = None
        self.t: F = None
        self.o: E = None
        self.u: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

c = A("c")
k = B("k")
j = C("j")
m = D("m")
a = E("a")
g = F("g")
l = C("l")
f = C("f")
h = F("h")

c.p = g
c.q = m
c.v = j
c.t = h
c.o = a
c.u = a
k.o = j
k.p = m
k.t = a
j.q = g
m.u = c
m.y = c
m.p = c
m.r = f
m.x = f
a.t = m
g.p = k
g.u = c
g.s = h
l.q = g
f.q = g
h.p = k
h.u = c
h.s = g
assert a.t.r.q.s.s.txt == "g"