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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: C = None
        self.v: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: D = None
        self.o: B = None
        self.y: A = None
        self.p: B = None
        self.txt = txt

j = A("j")
c = B("c")
f = C("f")
k = D("k")
b = E("b")
h = F("h")

j.r = f
j.o = f
j.p = c
c.r = b
c.s = f
c.v = f
f.o = h
k.z = b
k.s = b
b.y = k
b.w = k
b.r = c
h.q = c
h.o = c
h.p = c
h.t = k
h.y = j
assert k.s.y.s.r.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: C = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: C = None
        self.v: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: D = None
        self.o: B = None
        self.y: A = None
        self.p: B = None
        self.txt = txt

j = A("j")
c = B("c")
f = C("f")
k = D("k")
b = E("b")
h = F("h")

j.r = f
j.o = f
j.p = c
c.r = b
c.s = f
c.v = f
f.o = h
k.z = b
k.s = b
b.y = k
b.w = k
b.r = c
h.q = c
h.o = c
h.p = c
h.t = k
h.y = j
assert k.s.y.s.r.s.o.txt == "h"