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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: B = None
        self.o: B = None
        self.x: D = None
        self.p: B = None
        self.txt = txt

g = A("g")
k = B("k")
l = C("l")
d = D("d")
c = E("c")
h = F("h")
b = B("b")
j = C("j")

g.q = j
g.o = h
k.q = d
k.r = h
l.s = g
l.u = b
l.q = h
l.w = c
d.t = k
c.q = b
h.v = g
h.w = k
h.o = k
h.x = d
h.p = b
b.q = d
b.r = h
j.s = g
j.u = k
j.q = h
j.w = c
assert j.q.w.q.t.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: B = None
        self.o: B = None
        self.x: D = None
        self.p: B = None
        self.txt = txt

g = A("g")
k = B("k")
l = C("l")
d = D("d")
c = E("c")
h = F("h")
b = B("b")
j = C("j")

g.q = j
g.o = h
k.q = d
k.r = h
l.s = g
l.u = b
l.q = h
l.w = c
d.t = k
c.q = b
h.v = g
h.w = k
h.o = k
h.x = d
h.p = b
b.q = d
b.r = h
j.s = g
j.u = k
j.q = h
j.w = c
assert j.q.w.q.t.r.p.txt == "b"